﻿using EnglishAuction.BUS;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace EnglishAuction
{
    public partial class AdminTemplate : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            NhanVien nhanVien = Session["CurrentAdmin"] as NhanVien;
            //NhanVien nhanVien = null;
            if (Request.Cookies["Admin"] != null)
                nhanVien = NhanVienBUS.GetByUsername(Request.Cookies["Admin"].Value);
            if (nhanVien != null && nhanVien.LoaiNhanVienId == 2)
            {
                adminPanel.Visible = true;
                nameAdminCurrent.Text = nhanVien.HoTen;
            }
            else
            {
                Response.Redirect("AccessDeny.aspx");
            }
        }
    }
}